<h1 id="pigz">pigz</h1>
<p>可以用来解压缩文件，gzip的并行实现升级版。</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>pigz命令</strong>可以用来解压缩文件，最重要的是支持多线程并行处理，解压缩比gzip快。主页: <a href="http://zlib.net/pigz/">http://zlib.net/pigz/</a></p>
<h3 id="语法">语法</h3>
<div class="sourceCode" id="cb1"><pre><code class="language-bash"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="ex">pigz</span> [ -cdfhikKlLmMnNqrRtz0..9,11 ] [ -b blocksize ] [ -p threads ] [ -S suffix ] [ name ...  ]</a>
<a class="sourceLine" id="cb1-2" data-line-number="2"><span class="ex">unpigz</span> [ -cfhikKlLmMnNqrRtz ] [ -b blocksize ] [ -p threads ] [ -S suffix ] [ name ...  ]</a></code></pre></div>
<h3 id="参数">参数</h3>
<div class="sourceCode" id="cb2"><pre><code class="language-bash"><a class="sourceLine" id="cb2-1" data-line-number="1"><span class="ex">-0</span> to -9, -11        Compression level (level 11, zopfli, is much slower)</a>
<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="ex">--fast</span>, --best       Compression levels 1 and 9 respectively</a>
<a class="sourceLine" id="cb2-3" data-line-number="3"><span class="ex">-b</span>, --blocksize mmm  Set compression block size to mmmK (default 128K)</a>
<a class="sourceLine" id="cb2-4" data-line-number="4"><span class="ex">-c</span>, --stdout         Write all processed output to stdout (won<span class="st">&#39;t delete)</span></a>
<a class="sourceLine" id="cb2-5" data-line-number="5"><span class="st">-d, --decompress     Decompress the compressed input</span></a>
<a class="sourceLine" id="cb2-6" data-line-number="6"><span class="st">-f, --force          Force overwrite, compress .gz, links, and to terminal</span></a>
<a class="sourceLine" id="cb2-7" data-line-number="7"><span class="st">-F  --first          Do iterations first, before block split for -11</span></a>
<a class="sourceLine" id="cb2-8" data-line-number="8"><span class="st">-h, --help           Display a help screen and quit</span></a>
<a class="sourceLine" id="cb2-9" data-line-number="9"><span class="st">-i, --independent    Compress blocks independently for damage recovery</span></a>
<a class="sourceLine" id="cb2-10" data-line-number="10"><span class="st">-I, --iterations n   Number of iterations for -11 optimization</span></a>
<a class="sourceLine" id="cb2-11" data-line-number="11"><span class="st">-J, --maxsplits n    Maximum number of split blocks for -11</span></a>
<a class="sourceLine" id="cb2-12" data-line-number="12"><span class="st">-k, --keep           Do not delete original file after processing</span></a>
<a class="sourceLine" id="cb2-13" data-line-number="13"><span class="st">-K, --zip            Compress to PKWare zip (.zip) single entry format</span></a>
<a class="sourceLine" id="cb2-14" data-line-number="14"><span class="st">-l, --list           List the contents of the compressed input</span></a>
<a class="sourceLine" id="cb2-15" data-line-number="15"><span class="st">-L, --license        Display the pigz license and quit</span></a>
<a class="sourceLine" id="cb2-16" data-line-number="16"><span class="st">-m, --no-time        Do not store or restore mod time</span></a>
<a class="sourceLine" id="cb2-17" data-line-number="17"><span class="st">-M, --time           Store or restore mod time</span></a>
<a class="sourceLine" id="cb2-18" data-line-number="18"><span class="st">-n, --no-name        Do not store or restore file name or mod time</span></a>
<a class="sourceLine" id="cb2-19" data-line-number="19"><span class="st">-N, --name           Store or restore file name and mod time</span></a>
<a class="sourceLine" id="cb2-20" data-line-number="20"><span class="st">-O  --oneblock       Do not split into smaller blocks for -11</span></a>
<a class="sourceLine" id="cb2-21" data-line-number="21"><span class="st">-p, --processes n    Allow up to n compression threads (default is the number of online processors, or 8 if unknown)</span></a>
<a class="sourceLine" id="cb2-22" data-line-number="22"><span class="st">-q, --quiet          Print no messages, even on error</span></a>
<a class="sourceLine" id="cb2-23" data-line-number="23"><span class="st">-r, --recursive      Process the contents of all subdirectories</span></a>
<a class="sourceLine" id="cb2-24" data-line-number="24"><span class="st">-R, --rsyncable      Input-determined block locations for rsync</span></a>
<a class="sourceLine" id="cb2-25" data-line-number="25"><span class="st">-S, --suffix .sss    Use suffix .sss instead of .gz (for compression)</span></a>
<a class="sourceLine" id="cb2-26" data-line-number="26"><span class="st">-t, --test           Test the integrity of the compressed input</span></a>
<a class="sourceLine" id="cb2-27" data-line-number="27"><span class="st">-v, --verbose        Provide more verbose output</span></a>
<a class="sourceLine" id="cb2-28" data-line-number="28"><span class="st">-V  --version        Show the version of pigz</span></a>
<a class="sourceLine" id="cb2-29" data-line-number="29"><span class="st">-Y  --synchronous    Force output file write to permanent storage</span></a>
<a class="sourceLine" id="cb2-30" data-line-number="30"><span class="st">-z, --zlib           Compress to zlib (.zz) instead of gzip format</span></a>
<a class="sourceLine" id="cb2-31" data-line-number="31"><span class="st">--                   All arguments after &quot;--&quot; are treated as files</span></a></code></pre></div>
<h3 id="实例">实例</h3>
<p>可以结合<code>tar</code>使用, 压缩命令</p>
<div class="sourceCode" id="cb3"><pre><code class="language-bash"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="fu">tar</span> -cvf - dir1 dir2 dir3 <span class="kw">|</span> <span class="ex">pigz</span> -p 8 <span class="op">&gt;</span> output.tgz</a></code></pre></div>
<p>解压命令</p>
<div class="sourceCode" id="cb4"><pre><code class="language-bash"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="ex">pigz</span> -p 8 -d output.tgz</a></code></pre></div>
<p>如果是gzip格式，也支持用tar解压</p>
<div class="sourceCode" id="cb5"><pre><code class="language-bash"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="fu">tar</span> -xzvf output.tgz</a></code></pre></div>
